package com.yanggu.scala.chapater12.execrise

object MatchExercise01 {

  def main(args: Array[String]): Unit = {
    for (c <- "+-3!") {
      var sign = 0
      var digit = 0
      c match {
        case '+' => sign = 1
        case '-' => sign = -1
        //这里如果有多个case _ 分支。并不会继续向下执行。同时编译器不会报错
        case _ => digit = 3
        case _ => sign = 2
      }
      println(c + "\t" + sign + "\t" + digit)
    }
  }

}
